package edu.neusoft.springhtmldemo.controller;

import edu.neusoft.springhtmldemo.domain.SensorManagement;
import edu.neusoft.springhtmldemo.service.SensorManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SensorManagementController {
    @Autowired
    private SensorManagementService service;

    @ResponseBody
    @RequestMapping("/showSensorManagement")
    private List<SensorManagement> showSensorManagement(){
        return service.showSensorManagement();
    }

    @ResponseBody
    @RequestMapping("/updateSensorManagement")
    public void updateSensorManagement(SensorManagement sensorManagement){
        System.out.println(sensorManagement);
        service.updateSensorManagement(sensorManagement);
    }


    @ResponseBody
    @RequestMapping("/selectSensorManagement")
    private List<SensorManagement> selectSensorManagement(String sensorNum,String sensorName){
        return service.selectSensorManagement(sensorNum,sensorName);
    }


}
